package top.yzlin.dblock.component;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import redis.clients.jedis.JedisPool;

@Component
public class RedisLockFactory {
    private JedisPool jedisPool;

    @Autowired
    public void setJedisPool(JedisPool jedisPool) {
        this.jedisPool = jedisPool;
    }

    public RedisLock newRedisLock(String resourceMark) {
        return new RedisLock(jedisPool.getResource(), resourceMark);
    }

}
